#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "MyFmt.h"
#include "utf8proc.h"

int main(void)
{
    const char *src = "世界是由原子组成的, Héllo WÖRLD！";
    utf8proc_uint8_t *dst = NULL;

    /* NFC 规范化 + 大小写折叠 */
    utf8proc_ssize_t len = utf8proc_map((const utf8proc_uint8_t *)src, 0, &dst,
                                        (utf8proc_option_t)(UTF8PROC_NULLTERM | UTF8PROC_STABLE | UTF8PROC_COMPOSE | UTF8PROC_CASEFOLD));

    if (len < 0)
    {
        fprintf(stderr, "utf8proc error: %s\n", utf8proc_errmsg(len));
        return EXIT_FAILURE;
    }

    printf("Result: %s\n", dst);
    free(dst);
    return EXIT_SUCCESS;
}